var o, e = require, t = module, n = exports, i = this && this.__extends || (o = function(t, e) {
    return (o = Object.setPrototypeOf || {
        __proto__: []
    } instanceof Array && function(t, e) {
        t.__proto__ = e;
    } || function(t, e) {
        for (var o in e) e.hasOwnProperty(o) && (t[o] = e[o]);
    })(t, e);
}, function(t, e) {
    function i() {
        this.constructor = t;
    }
    o(t, e), t.prototype = null === e ? Object.create(e) : (i.prototype = e.prototype, 
    new i());
}), a = this && this.__decorate || function(t, e, o, i) {
    var s, n = arguments.length, r = n < 3 ? e : null === i ? i = Object.getOwnPropertyDescriptor(e, o) : i;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, i); else for (var c = t.length - 1; 0 <= c; c--) (s = t[c]) && (r = (n < 3 ? s(r) : 3 < n ? s(e, o, r) : s(e, o)) || r);
    return 3 < n && r && Object.defineProperty(e, o, r), r;
};

Object.defineProperty(n, "__esModule", {
    value: !0
}), n.BlockType = void 0;

var r, s, c = e("EditItem"), l = e("EditBox"), d = e("EditMenu"), u = cc._decorator, p = u.ccclass, h = u.property;

(function(t) {
    t[t.MOVE = 0] = "MOVE", t[t.ADD = 1] = "ADD", t[t.DEL = 2] = "DEL";
})(r = r || {}), function(t) {
    t[t.DEFAULT = 0] = "DEFAULT", t[t.BLOCK = 1] = "BLOCK", t[t.BOX = 2] = "BOX", t[t.GRASS = 3] = "GRASS", 
    t[t.DRESS = 4] = "DRESS", t[t.WATER = 5] = "WATER", t[t.POINT = 6] = "POINT", t[t.ENEMY_POINT = 7] = "ENEMY_POINT", 
    t[t.DRESS_BLOCK = 8] = "DRESS_BLOCK", t[t.DRESS_BIG = 9] = "DRESS_BIG";
}(s = n.BlockType || (n.BlockType = {}));

var f = function(e) {
    function t() {
        var t = null !== e && e.apply(this, arguments) || this;
        return t.bg = null, t.layout = null, t.touch = null, t.tex = null, t.texSelect = null, 
        t.texCheck = null, t.scrollView = null, t.tempItem = null, t.tempBox = null, t.tempPoint = null, 
        t.tempMenu = null, t.lLabel = null, t.xLabel = null, t.yLabel = null, t.toggleContainer = null, 
        t.curItem = null, t.boxs = [], t.state = r.MOVE, t.isShow = !1, t.isDel = !1, t.startPos = null, 
        t.endPos = null, t.selectStartPos = null, t.selectEndPos = null, t.selectGird = null, 
        t.selectDatas = [], t.copyGird = null, t.copyDatas = [], t.w = 32, t.h = 18, t._pressKeyFlags = 0, 
        t;
    }
    var o;
    return i(t, e), (o = t).prototype.onLoad = function() {
        this._initKeyEvent();
    }, t.prototype.onEnable = function() {
        var s = this;
        this.node.on("checked", function(t) {
            t = t.target.getComponent(c.default);
            t && (s.toggleContainer.toggleItems[0].isChecked = !0, s.isDel = !1, t.toggle.isChecked ? s.curItem = t : s.curItem = null);
        }, this), this.touch.on(cc.Node.EventType.MOUSE_DOWN, function(t) {
            t = t.getButton();
            t == cc.Event.EventMouse.BUTTON_LEFT ? s.isDel ? s.state = r.DEL : s.state = r.ADD : t == cc.Event.EventMouse.BUTTON_RIGHT && (s.state = r.MOVE);
        }), this.touch.on(cc.Node.EventType.MOUSE_UP, function(t) {
            var e, o = t.getButton();
            o == cc.Event.EventMouse.BUTTON_LEFT ? s.tempMenu.hide() : o == cc.Event.EventMouse.BUTTON_RIGHT && s.startPos && s.endPos && s.startPos.sub(s.endPos).mag() < 1 && (e = t.getLocation(), 
            0 < s.selectDatas.length ? (t = s.selectDatas.some(function(t) {
                t = t.rect;
                return e.x <= t.xMax && e.x >= t.xMin && e.y <= t.yMax && e.y >= t.yMin;
            }), s.tempMenu.show({
                pos: s.bg.convertToNodeSpaceAR(e),
                isCopy: t,
                isPaste: null != s.copyGird,
                isDelete: t
            })) : null != s.copyGird ? s.tempMenu.show({
                pos: s.bg.convertToNodeSpaceAR(e),
                isPaste: !0
            }) : s.tempMenu.hide());
        }), this.touch.on(cc.Node.EventType.TOUCH_START, function(t) {
            switch (s.startPos = t.getLocation(), s.state) {
              case r.MOVE:
                break;

              case r.ADD:
                s.curItem || (s.selectStartPos = s.startPos);
            }
        }, this), this.touch.on(cc.Node.EventType.TOUCH_MOVE, function(t) {
            var e, o = t.getLocation(), i = t.getPreviousLocation();
            switch (s.state) {
              case r.MOVE:
                s.doMove(s.bg.getPosition().add(o.sub(i)));
                break;

              case r.ADD:
                s.curItem ? (s.texCheck.clear(), e = cc.v2(t.getLocation()), s.appendBox(e, s.curItem.type, s.curItem.sprite.spriteFrame)) : s.selectBox(t.getLocation());
                break;

              case r.DEL:
                s.removeBox(o);
            }
        }, this), this.touch.on(cc.Node.EventType.TOUCH_END, function(t) {
            switch (s.endPos = t.getLocation(), s.texSelect.clear(), s.state) {
              case r.MOVE:
                break;

              case r.ADD:
                s.curItem && s.appendBox(s.endPos, s.curItem.type, s.curItem.sprite.spriteFrame), 
                s.boxs.forEach(function(t) {
                    return t.state = l.BoxState.COMPLETE;
                });
                break;

              case r.DEL:
                s.removeBox(s.endPos);
            }
        }, this), this.touch.on(cc.Node.EventType.MOUSE_WHEEL, function(t) {
            0 < t.getScrollY() ? .2 < s.bg.scale && (s.bg.scale -= .01) : s.bg.scale < 3 && (s.bg.scale += .01);
        }, this);
    }, t.prototype.selectBox = function(t) {
        var e, o, i, s = this;
        this.selectStartPos && (this.selectEndPos = t, e = this.bg.convertToNodeSpaceAR(this.selectStartPos), 
        t = this.bg.convertToNodeSpaceAR(this.selectEndPos), this.texSelect.clear(), this.texSelect.rect(Math.min(e.x, t.x), Math.min(e.y, t.y), Math.abs(e.x - t.x), Math.abs(e.y - t.y)), 
        this.texSelect.stroke(), this.texCheck.clear(), i = o = null, this.selectDatas = this.boxs.filter(function(t) {
            var e = t.node.convertToWorldSpaceAR(cc.Vec2.ZERO);
            if (e.x <= Math.max(s.selectStartPos.x, s.selectEndPos.x) && e.x >= Math.min(s.selectStartPos.x, s.selectEndPos.x) && e.y <= Math.max(s.selectStartPos.y, s.selectEndPos.y) && e.y >= Math.min(s.selectStartPos.y, s.selectEndPos.y)) {
                e = t.node.getBoundingBox();
                return s.texCheck.rect(e.xMin, e.yMin, e.width, e.height), (!o || t.node.x < o) && (o = t.node.x), 
                (!i || t.node.y > i) && (i = t.node.y), !0;
            }
            return !1;
        }).map(function(t) {
            return {
                rect: t.node.getBoundingBoxToWorld(),
                type: t.type,
                gird: t.gird,
                spriteFrame: t.sprite.spriteFrame
            };
        }), this.selectGird = this.getGird(cc.v2(o, i)), this.texCheck.stroke());
    }, t.prototype.onClickShow = function() {
        this.isShow = !0, this.boxs.forEach(function(t) {
            return t.label.node.active = !0;
        });
    }, t.prototype.onClickHide = function() {
        this.isShow = !1, this.boxs.forEach(function(t) {
            return t.label.node.active = !1;
        });
    }, t.prototype.onClickDel = function() {
        this.isDel = !0;
    }, t.prototype.onClickEdit = function() {
        this.isDel = !1;
    }, t.prototype.onClickBlock = function() {
        this.loadRes("block", s.BLOCK);
    }, t.prototype.onClickWater = function() {
        this.loadRes("water", s.WATER);
    }, t.prototype.onClickShadow = function() {
        this.loadRes("grass", s.GRASS);
    }, t.prototype.onClickTree = function() {
        this.loadRes("box", s.BOX);
    }, t.prototype.onClickDress = function() {
        this.loadRes("dress", s.DRESS);
    }, t.prototype.onClickDefault = function() {
        this.loadRes("default", s.DEFAULT);
    }, t.prototype.onClickDressBig = function() {
        this.loadRes("", s.DRESS_BIG, "texture/map/dressBig");
    }, t.prototype.onClickDressBlock = function() {
        this.scrollView.content.removeAllChildren();
        var t = cc.instantiate(this.tempPoint), e = t.getComponent(c.default);
        e && (e.init({
            type: s.DRESS_BLOCK
        }), e.sprite.node.color = cc.Color.BLACK, e.sprite.node.opacity = 100), t.parent = this.scrollView.content;
    }, t.prototype.onClickPoint = function() {
        this.scrollView.content.removeAllChildren();
        var t = cc.instantiate(this.tempPoint), e = t.getComponent(c.default);
        e && e.init({
            type: s.POINT
        }), t.parent = this.scrollView.content, (e = (t = cc.instantiate(this.tempPoint)).getComponent(c.default)) && (e.init({
            type: s.ENEMY_POINT
        }), e.sprite.node.color = cc.Color.BLACK), t.parent = this.scrollView.content;
    }, t.prototype.onClickCopy = function() {
        this.selectGird && 0 < this.selectDatas.length && (this.copyGird = this.selectGird.clone(), 
        this.copyDatas = this.selectDatas.map(function(t) {
            return {
                type: t.type,
                gird: t.gird,
                spriteFrame: t.spriteFrame
            };
        }), this.tempMenu.hide());
    }, t.prototype.onClickPaste = function() {
        var t, o, i = this;
        this.copyGird && 0 < this.copyDatas.length && (t = this.bg.convertToNodeSpaceAR(this.endPos), 
        o = this.getGird(t), this.copyDatas.forEach(function(t) {
            var e = o.add(t.gird.sub(i.copyGird));
            0 <= e.x && e.x < i.w && 0 <= e.y && e.y < i.h && (e = cc.v2(i.tempBox.width * e.x - (i.bg.width - i.tempBox.width) / 2, i.tempBox.height * e.y - (i.bg.height - i.tempBox.height) / 2), 
            i.appendBox(i.bg.convertToWorldSpaceAR(e), t.type, t.spriteFrame));
        }), this.tempMenu.hide());
    }, t.prototype.onClickDelete = function() {
        var e = this;
        this.selectGird && 0 < this.selectDatas.length && (this.selectDatas.forEach(function(t) {
            t = cc.v2(e.tempBox.width * t.gird.x - (e.bg.width - e.tempBox.width) / 2, e.tempBox.height * t.gird.y - (e.bg.height - e.tempBox.height) / 2);
            e.removeBox(e.bg.convertToWorldSpaceAR(t));
        }), this.selectGird = null, this.selectDatas = [], this.tempMenu.hide(), this.texCheck.clear());
    }, t.prototype.start = function() {
        this.doDraw(), this.loadRes("block", s.BLOCK);
    }, t.prototype._initKeyEvent = function() {
        cc.systemEvent.on(cc.SystemEvent.EventType.KEY_DOWN, this._keyDownEvent, this), 
        cc.systemEvent.on(cc.SystemEvent.EventType.KEY_UP, this._keyUpEvent, this);
    }, t.prototype._keyDownEvent = function(t) {
        switch (t.keyCode) {
          case cc.macro.KEY.a:
            this._pressKeyFlags |= o.LEFT;
            break;

          case cc.macro.KEY.d:
            this._pressKeyFlags |= o.RIGHT;
            break;

          case cc.macro.KEY.w:
            this._pressKeyFlags |= o.UP;
            break;

          case cc.macro.KEY.s:
            this._pressKeyFlags |= o.DOWN;
        }
        this._updateDirectionNormalized();
    }, t.prototype._keyUpEvent = function(t) {
        switch (t.keyCode) {
          case cc.macro.KEY.a:
            this._pressKeyFlags &= ~o.LEFT;
            break;

          case cc.macro.KEY.d:
            this._pressKeyFlags &= ~o.RIGHT;
            break;

          case cc.macro.KEY.w:
            this._pressKeyFlags &= ~o.UP;
            break;

          case cc.macro.KEY.s:
            this._pressKeyFlags &= ~o.DOWN;
        }
        this._updateDirectionNormalized();
    }, t.prototype._updateDirectionNormalized = function() {
        var t = cc.Vec2.ZERO;
        0 < (this._pressKeyFlags & (o.LEFT | o.RIGHT)) && (t.x = 0 < (this._pressKeyFlags & o.LEFT) ? 1 : -1), 
        0 < (this._pressKeyFlags & (o.UP | o.DOWN)) && (t.y = 0 < (this._pressKeyFlags & o.DOWN) ? 1 : -1), 
        t.normalizeSelf(), this.bg.setPosition(this.bg.getPosition().add(t.mul(80)));
    }, t.prototype.loadRes = function(t, n, e) {
        var r = this;
        void 0 === e && (e = "texture/map/"), this.scrollView.content.removeAllChildren(), 
        cc.loader.loadResDir(e + t, cc.SpriteFrame, function(t, e, s) {
            return t ? console.error(t) : void e.forEach(function(t, e) {
                var o = cc.instantiate(r.tempItem), i = o.getComponent(c.default);
                i && (i.init({
                    url: s[e],
                    spriteFrame: t,
                    type: n
                }), i.sprite.node.scale = 80 / i.sprite.node.height), o.parent = r.scrollView.content;
            });
        });
    }, t.prototype.doDraw = function() {
        this.tex.clear();
        var t = Math.floor(this.bg.width / 80), e = Math.floor(this.bg.height / 80);
        this.tex.node.setPosition(cc.v2(-this.bg.width / 2, -this.bg.height / 2));
        for (var o = 1; o < t; o++) this.tex.moveTo(80 * o, 0), this.tex.lineTo(80 * o, this.bg.height);
        for (o = 1; o < e; o++) this.tex.moveTo(0, 80 * o), this.tex.lineTo(this.bg.width, 80 * o);
        this.tex.stroke();
    }, t.prototype.doMove = function(t) {
        this.bg.setPosition(t);
    }, t.prototype.appendBox = function(t, e, o) {
        t = cc.v2(this.bg.convertToNodeSpaceAR(t)), t = this.getGird(t);
        !t || (t = this.getBox(t, e)) && (t.state = l.BoxState.PROCESS, t.type = e, t.sprite.spriteFrame = o, 
        t.type == s.POINT ? (t.sprite.node.setContentSize(80, 80), t.sprite.node.opacity = 255) : t.type == s.ENEMY_POINT ? (t.sprite.node.setContentSize(80, 80), 
        t.sprite.node.color = cc.Color.BLACK, t.sprite.node.opacity = 255) : t.type == s.DRESS_BLOCK ? (t.sprite.node.setContentSize(80, 80), 
        t.sprite.node.color = cc.Color.BLACK, t.sprite.node.opacity = 100) : t.sprite.node.opacity = 255, 
        t.label.node.active = this.isShow);
    }, t.prototype.removeBox = function(t) {
        var t = cc.v2(this.bg.convertToNodeSpaceAR(t)), e = this.getGird(t), o = !1;
        if (e) for (var i = this.boxs.filter(function(t) {
            return t.gird.equals(e);
        }); 0 < i.length; ) {
            var s = i.pop();
            this.boxs.splice(this.boxs.indexOf(s), 1), s.node.destroy(), o = !(s = null);
        }
        return o;
    }, t.prototype.getGird = function(t) {
        if (t.x > this.bg.width / 2 || t.y > this.bg.height / 2 || t.x < -this.bg.width / 2 || t.y < -this.bg.height / 2) return null;
        t = cc.v2(t.x + this.bg.width / 2, t.y + this.bg.height / 2);
        return cc.v2(Math.floor(t.x / this.tempBox.width), Math.floor(t.y / this.tempBox.height));
    }, t.prototype.getBox = function(e, t) {
        if ((t = void 0 === t ? s.DEFAULT : t) == s.DRESS_BLOCK) return this.getDressBlock(e);
        if (t == s.DRESS || t == s.DRESS_BIG) return this.getDress(e);
        var o = this.boxs.filter(function(t) {
            return t.gird.equals(e) && t.type != s.DRESS && t.type != s.DRESS_BIG;
        });
        if (0 < o.length) return o[0];
        t = cc.instantiate(this.tempBox), o = t.getComponent(l.default);
        return o ? (o.gird = e, o.refresh(), o.type == s.WATER ? t.zIndex = -o.gird.y - 200 : o.type == s.DRESS ? t.zIndex = -o.gird.y - 100 : o.type == s.DRESS_BIG ? t.zIndex = 100 - o.gird.y : t.zIndex = -o.gird.y, 
        t.parent = this.layout, t.setPosition(cc.v2(this.tempBox.width * e.x - (this.bg.width - this.tempBox.width) / 2, this.tempBox.height * e.y - (this.bg.height - this.tempBox.height) / 2)), 
        this.boxs.push(o), o) : null;
    }, t.prototype.getDress = function(e) {
        var t = this.boxs.filter(function(t) {
            return t.gird.equals(e) && (t.type == s.DRESS || t.type == s.DRESS_BIG);
        });
        if (0 < t.length) return t[0];
        var o = cc.instantiate(this.tempBox), t = o.getComponent(l.default);
        return t ? (t.gird = e, t.refresh(), t.type == s.WATER ? o.zIndex = -t.gird.y - 200 : t.type == s.DRESS ? o.zIndex = -t.gird.y - 100 : t.type == s.DRESS_BIG ? o.zIndex = 100 - t.gird.y : o.zIndex = -t.gird.y, 
        o.parent = this.layout, o.setPosition(cc.v2(this.tempBox.width * e.x - (this.bg.width - this.tempBox.width) / 2, this.tempBox.height * e.y - (this.bg.height - this.tempBox.height) / 2)), 
        this.boxs.push(t), t) : null;
    }, t.prototype.getDressBlock = function(e) {
        var t = this.boxs.filter(function(t) {
            return t.gird.equals(e) && t.type != s.DRESS && t.type != s.DRESS_BIG;
        });
        if (0 < t.length) return t[0];
        var o = cc.instantiate(this.tempBox), t = o.getComponent(l.default);
        return t ? (t.gird = e, t.refresh(), o.zIndex = 200 - e.y, o.parent = this.layout, 
        o.setPosition(cc.v2(this.tempBox.width * e.x - (this.bg.width - this.tempBox.width) / 2, this.tempBox.height * e.y - (this.bg.height - this.tempBox.height) / 2)), 
        this.boxs.push(t), t) : null;
    }, t.prototype.getKey = function() {
        return this.lLabel.string || "1";
    }, t.prototype.gen = function() {
        var e = this, t = parseInt(this.xLabel.string), o = parseInt(this.yLabel.string);
        isNaN(t) || (this.w = t), isNaN(o) || (this.h = o), this.bg.setContentSize(80 * this.w, 80 * this.h), 
        this.boxs.forEach(function(t) {
            t.gird = e.getGird(t.node.getPosition()), t.refresh();
        }), this.doDraw();
    }, t.prototype.save = function() {
        var t = this.getKey(), e = {
            size: {
                width: this.w,
                height: this.h
            },
            point: this.boxs.filter(function(t) {
                return t.type == s.POINT;
            }).map(function(t) {
                return {
                    x: t.gird.x,
                    y: t.gird.y
                };
            }),
            enemy_point: this.boxs.filter(function(t) {
                return t.type == s.ENEMY_POINT;
            }).map(function(t) {
                return {
                    x: t.gird.x,
                    y: t.gird.y
                };
            }),
            dress_block: this.boxs.filter(function(t) {
                return t.type == s.DRESS_BLOCK;
            }).map(function(t) {
                return {
                    x: t.gird.x,
                    y: t.gird.y
                };
            }),
            boxs: this.boxs.filter(function(t) {
                return t.type != s.POINT && t.type != s.ENEMY_POINT && t.type != s.DRESS_BLOCK;
            }).map(function(t) {
                return {
                    n: t.sprite.spriteFrame.name,
                    t: t.type,
                    g: {
                        x: t.gird.x,
                        y: t.gird.y
                    }
                };
            })
        };
        this.saveForBrowser(JSON.stringify(e), t);
    }, t.prototype.load = function() {
        var n = this;
        cc.resources.load("json/" + this.getKey(), cc.JsonAsset, function(t, e) {
            return t ? console.error(t) : (n.boxs.forEach(function(t) {
                t.node.destroy();
            }), n.boxs = [], n.layout.removeAllChildren(), e.json.size && (n.w = e.json.size.width, 
            n.h = e.json.size.height, n.bg.setContentSize(cc.size(80 * e.json.size.width, 80 * e.json.size.height)), 
            n.doDraw()), e.json.point && e.json.point.forEach(function(t) {
                var e, o = cc.instantiate(n.tempBox);
                !o || (e = o.getComponent(l.default)) && (o.zIndex = -t.y, o.parent = n.layout, 
                o.setPosition(cc.v2(n.tempBox.width * t.x - (n.bg.width - n.tempBox.width) / 2, n.tempBox.height * t.y - (n.bg.height - n.tempBox.height) / 2)), 
                n.boxs.push(e), e.gird = cc.v2(t), e.refresh(), e.state = l.BoxState.PROCESS, e.type = s.POINT, 
                e.sprite.spriteFrame = n.tempPoint.getComponent(c.default).sprite.spriteFrame, e.sprite.node.setContentSize(80, 80), 
                e.label.node.active = n.isShow);
            }), e.json.enemy_point && e.json.enemy_point.forEach(function(t) {
                var e, o = cc.instantiate(n.tempBox);
                !o || (e = o.getComponent(l.default)) && (o.zIndex = -t.y, o.parent = n.layout, 
                o.setPosition(cc.v2(n.tempBox.width * t.x - (n.bg.width - n.tempBox.width) / 2, n.tempBox.height * t.y - (n.bg.height - n.tempBox.height) / 2)), 
                n.boxs.push(e), e.gird = cc.v2(t), e.refresh(), e.state = l.BoxState.PROCESS, e.type = s.ENEMY_POINT, 
                e.sprite.node.color = cc.Color.BLACK, e.sprite.spriteFrame = n.tempPoint.getComponent(c.default).sprite.spriteFrame, 
                e.sprite.node.setContentSize(80, 80), e.label.node.active = n.isShow);
            }), e.json.dress_block && e.json.dress_block.forEach(function(t) {
                var e, o = cc.instantiate(n.tempBox);
                !o || (e = o.getComponent(l.default)) && (o.zIndex = 200 - t.y, o.parent = n.layout, 
                o.setPosition(cc.v2(n.tempBox.width * t.x - (n.bg.width - n.tempBox.width) / 2, n.tempBox.height * t.y - (n.bg.height - n.tempBox.height) / 2)), 
                n.boxs.push(e), e.gird = cc.v2(t), e.refresh(), e.state = l.BoxState.PROCESS, e.type = s.DRESS_BLOCK, 
                e.sprite.node.color = cc.Color.BLACK, e.sprite.spriteFrame = n.tempPoint.getComponent(c.default).sprite.spriteFrame, 
                e.sprite.node.opacity = 100, e.sprite.node.setContentSize(80, 80), e.label.node.active = n.isShow);
            }), void (e.json.boxs && e.json.boxs.forEach(function(i) {
                var t = "";
                switch (i.t) {
                  case s.DEFAULT:
                    t = "texture/map/default/" + i.n;
                    break;

                  case s.BLOCK:
                    t = "texture/map/block/" + i.n;
                    break;

                  case s.BOX:
                    t = "texture/map/box/" + i.n;
                    break;

                  case s.GRASS:
                    t = "texture/map/grass/" + i.n;
                    break;

                  case s.WATER:
                    t = "texture/map/water/" + i.n;
                    break;

                  case s.DRESS:
                    t = "texture/map/dress/" + i.n;
                    break;

                  case s.DRESS_BIG:
                    t = "texture/map/dressBig/" + i.n;
                }
                t ? cc.resources.load(t, cc.SpriteFrame, function(t, e) {
                    t && console.error(t);
                    var o = cc.instantiate(n.tempBox), t = o.getComponent(l.default);
                    t && (t.gird = cc.v2(i.g), t.type = i.t, t.sprite.spriteFrame = e, t.refresh(), 
                    t.type == s.WATER ? o.zIndex = -t.gird.y - 200 : t.type == s.DRESS ? o.zIndex = -t.gird.y - 100 : t.type == s.DRESS_BIG ? o.zIndex = 100 - t.gird.y : o.zIndex = -t.gird.y, 
                    o.setParent(n.layout), o.setPosition(cc.v2(n.tempBox.width * t.gird.x - (n.bg.width - n.tempBox.width) / 2, n.tempBox.height * t.gird.y - (n.bg.height - n.tempBox.height) / 2)), 
                    n.boxs.push(t));
                }) : cc.error(i);
            })));
        });
    }, t.prototype.saveForBrowser = function(t, e) {
        var o;
        cc.sys.isBrowser && (console.log("浏览器"), o = new Blob([ t ], {
            type: "application/json"
        }), (t = document.createElement("a")).download = e, t.innerHTML = "Download File", 
        null != window.webkitURL ? t.href = window.webkitURL.createObjectURL(o) : (t.href = window.URL.createObjectURL(o), 
        t.onclick = window.destroyClickedElement, t.style.display = "none", document.body.appendChild(t)), 
        t.click());
    }, t.LEFT = 1, t.RIGHT = 2, t.UP = 4, t.DOWN = 8, a([ h(cc.Node) ], t.prototype, "bg", void 0), 
    a([ h(cc.Node) ], t.prototype, "layout", void 0), a([ h(cc.Node) ], t.prototype, "touch", void 0), 
    a([ h(cc.Graphics) ], t.prototype, "tex", void 0), a([ h(cc.Graphics) ], t.prototype, "texSelect", void 0), 
    a([ h(cc.Graphics) ], t.prototype, "texCheck", void 0), a([ h(cc.ScrollView) ], t.prototype, "scrollView", void 0), 
    a([ h(cc.Node) ], t.prototype, "tempItem", void 0), a([ h(cc.Node) ], t.prototype, "tempBox", void 0), 
    a([ h(cc.Node) ], t.prototype, "tempPoint", void 0), a([ h(d.default) ], t.prototype, "tempMenu", void 0), 
    a([ h(cc.Label) ], t.prototype, "lLabel", void 0), a([ h(cc.Label) ], t.prototype, "xLabel", void 0), 
    a([ h(cc.Label) ], t.prototype, "yLabel", void 0), a([ h(cc.ToggleContainer) ], t.prototype, "toggleContainer", void 0), 
    o = a([ p ], t);
}(cc.Component);

n.default = f;